/**
  ******************************************************************************
  * @file    Project/STM32F10x_StdPeriph_Template/main.h 
  * @author  uLuxx
  * @version V1.0.0.
  * @date    15-August-2014
  * @brief   Header for main.c module
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2014</center></h2>
  ******************************************************************************
  */ 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"

/* Exported types ------------------------------------------------------------*/

typedef struct {
  unsigned char status;
  unsigned char source;
  int temperature;      /* Fixedpoint, divide by 4 to get float value */
} EGTData;

typedef struct{
  unsigned char status;
  unsigned char source;
  int afr;              /* AFR-Value multiplied by 10 */
} AFRData;

typedef struct {
  unsigned char status;
  unsigned char source;
  int rpm;              /* represents the current rpm value */
}RPMData;

typedef struct {
  unsigned char status;
  unsigned char source;
  int temperature;      /* Engine casing temperature */
}ECTData;

typedef struct {
  unsigned char status;
  unsigned char source;
  int mbar;             /* represents the current barometric pressure in mbar */
}baroData;

typedef struct {
  unsigned char status;
  unsigned char source;
  int tps;              /* represents the current opening of the tps in % */
}TPSData;

typedef struct {
  unsigned char status;
  unsigned char source;
  int neutral;          /* represents the current state of the neutral switch: 0 = not neutral, 1 = neutral, others not valid */
}NTRLData;

typedef struct {
  unsigned char status;
  unsigned char source;
  int speed;            /* represents the current speed in km/h */
}speedoData;

typedef struct {
  unsigned char status;
  unsigned char source;
  int voltage;          /* Battery voltage in volts multiplied by 10 */
}batteryData;

typedef struct {
  unsigned char status;
  unsigned char source;
  
}GPSData;



/* Exported defines --------------------------------------------------------*/
#define SRCINT  0
#define SRCEXT  1

#define EGTOK 0
#define EGTSENSORERROR 1
#define EGTERROR 254
#define EGTNODATA 255

#define AFROK 0
#define AFROFFLINE 1
#define AFRERROR 254
#define AFRNODATA 255

#define RPMOK 0
#define RPMSTAND 1
#define RPMUNRELIABLE 2
#define RPMERROR 254
#define RPMNODATA 255

#define ECTOK 0
#define ECTERROR 254
#define ECTNODATA 255

#define BAROOK 0
#define BAROOUTOFRANGE 1
#define BAROERROR 254
#define BARONODATA 255

#define TPSOK 0
#define TPSOUTOFRANGE 1
#define TPSERROR 254
#define TPSNODATA 255

#define NTRLOK 0
#define NTRLERROR 254
#define NTRLNODATA 255

#define SPEEDOK 0
#define SPEEDOUTOFRANGE 1
#define SPEEDERROR 254
#define SPEEDNODATA 255

#define BATTERYOK 0
#define BATTERYOUTOFRANGE 1
#define BATTERYERROR 254
#define BATTERYNODATA 255


/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void systemTimer(void);

void getSystemTime(unsigned int *time);

#endif /* __MAIN_H */

/******************* (C) COPYRIGHT 2014 *****END OF FILE****/
